import instance from '../../untils/axios.js'
import { getToken } from '../../untils/token.js'

function userlogin (mobile, code) {
  return instance({
    url: '/v1_0/authorizations',
    method: 'post',
    data: {
      mobile,
      code
    }
  })
}
export { userlogin }
function getuserInfo () {
  return instance({
    url: '/v1_0/user/profile',
    method: 'get',
    headers: {
      Authorization: `Bearer ${getToken().token}`
    }
  })
}
export { getuserInfo }
/* 编辑用户信息 */
function editUserInfo (data) {
  return instance({
    url: '/v1_0/user/profile',
    method: 'patch',
    data,
    headers: {
      Authorization: `Bearer ${getToken().token}`
    }
  })
}
export { editUserInfo }
function editUserPhoto (fd) {
  return instance({
    url: '/v1_0/user/photo',
    method: 'patch',
    data: fd,
    headers: {
      Authorization: `Bearer ${getToken().token}`
    }
  })
}
export { editUserPhoto }
